package com.liik.bomb.screen.action;

import com.liik.game.mvc.GameModel;
import com.liik.game.mvc.GameRenderer;
import com.liik.game.mvc.object.Menu.Item;
import com.liik.game.mvc.tiled.TiledGameController;

public class BombGameController extends TiledGameController {

	public final static int MENU_ID_PAUSE = 0;
	public final static int MENU_ID_EXIT = 1;

	@Override
	public void controlGained(Object message, GameModel gameModel, GameRenderer activeRenderer) {
		BombGameModel bombGameModel = (BombGameModel) gameModel;
		bombGameModel.start();
	}

	@Override
	public void handleMenuEvent(Item menuItem, GameModel activeModel) {
		switch (menuItem.id) {
		case MENU_ID_PAUSE: {
			if ("Pause".equals(menuItem.caption)) {
				menuItem.caption = "Resume";
				this.isPaused = true;
			} else {
				menuItem.caption = "Pause";
				this.isPaused = false;
			}
			break;
		}
		case MENU_ID_EXIT: {
			this.screenHolder.popScreen("Exit Pressed");
			break;
		}
		}
	}

	public static void plantBomb(GameModel activeModel) {
		BombGameModel gameModel = (BombGameModel) activeModel;
		BombEntity bomb = gameModel.getInactiveBomb();
		if (bomb != null) {
			bomb.activate(gameModel.getHero(), 3, 2000, 400);
		}
	}
}
